/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package com.architexa.org.eclipse.gef.handles;

import com.architexa.org.eclipse.draw2d.Cursors;
import com.architexa.org.eclipse.draw2d.Locator;
import com.architexa.org.eclipse.gef.EditPart;
import com.architexa.org.eclipse.gef.GraphicalEditPart;
import com.architexa.org.eclipse.gef.tools.DragEditPartsTracker;



/**
 * A MoveHandle for a non-resizable EditPart.
 *@deprecated this handle type is no longer used
 */
public class NonResizableHandle
	extends MoveHandle
{

/**
 * The border
 */
protected CornerTriangleBorder border;

/**
 * Creates a NonResizableHandle for the given <code>GraphicalEditPart</code>
 * using a default {@link Locator}.
 *
 * @param owner The GraphicalEditPart to be moved by this handle.
 */
public NonResizableHandle(GraphicalEditPart owner) {
	this(owner, new MoveHandleLocator(owner.getFigure()));
}

/**
 * Creates a NonResizableHandle for the given <code>GraphicalEditPart</code>
 * using the given <code>Locator</code>.
 *
 * @param owner The GraphicalEditPart to be moved by this handle.
 * @param loc   The Locator used to place the handle.
 */
public NonResizableHandle(GraphicalEditPart owner, Locator loc) {
	super(owner, loc);
}

/**
 * Initializes the handle.  Sets the {@link com.architexa.org.eclipse.gef.DragTracker} and
 * DragCursor.
 */
protected void initialize() {
	setOpaque(false);
	border = new CornerTriangleBorder(false);
	setBorder(border);
	setCursor(Cursors.SIZEALL);
	setDragTracker(new DragEditPartsTracker(getOwner()));
}

/**
 * Updates the handle's color by setting the border's primary
 * attribute.
 */
public void validate() {
	border.setPrimary(getOwner().getSelected() == EditPart.SELECTED_PRIMARY);
	super.validate();
}

}
